<template>
  <div id="app">
    <component v-bind:is="currentComponent"
               @component="change"></component>
    <!-- 显示路由对应的页面 -->
  </div>
</template>

<script>
import Login from './components/Login.vue'
import Backstage from './components/Backstage'
import Register from './components/Register'


export default {
  name: 'App',
  components: {
    Login,
    Backstage,
    Register
  },
  data () {
    return {
      currentComponent: 'login',
    }
  },
  methods: {
    change (is) {
      if (is == 1) {
        //后台组件
        this.currentComponent = 'backstage';
      } else if (is == 2) {
        //注册组件
        this.currentComponent = 'register';
      } else if (is == 0) {
        //登录组件
        this.currentComponent = 'login';
      }
    }
  }
}
</script>

<style>
</style>
